package com.crawleService.util.jinyeUtil;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class Main {
    public static void main(String[] args) {
        try {
            String dateString = "2024-03-31 02:37:24";
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
            Date date = sdf.parse(dateString);

            // 将时间转换为北京时间（GMT+8）
            sdf.setTimeZone(TimeZone.getTimeZone("GMT+8"));
            String beijingTime = sdf.format(date);
            System.out.println("北京时间：" + beijingTime);

            System.out.println("时间戳：" + date.getTime());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}